import Mock from 'mockjs'
const generalStatic = Mock.mock({
  "createdTaskNum|1-1000": 100,
  "createdProjectNum|1-1000": 100,
  "refusedTaskNum|1-1000": 100,
  "dueExpireNum|1-1000": 100,
  "dealtNum|1-1000": 100,
})

const recentTask = Mock.mock({
  'list|10': [{
    'id|+1': 1,
    taskName: '@cword(5, 20)',
    creator: '@cname()',
    'status|1': [0, 1, 2, 3, 4],
    createTime: '@date(yyyy-MM-dd)',
  }]
})

const taskMonthStatic = Mock.mock({
  'list|10': [{
    'destNum|1-1000': 100,
    'fishedNum|1-1000': 100,
  }]
})

export default [
  // task 概览
  {
    url: '/task/static/getTaskGeneralStatic',
    type: 'get',
    response: config => {
      return {
        code: 20000,
        data: generalStatic
      }
    }
  },
  // 最近任务
  {
    url: '/task/getLatestTaskList',
    type: 'get',
    response: config => {
      return {
        code: 20000,
        data: recentTask.list
      }
    }
  },
  // 首页统计
  {
    url: '/task/static/getTaskMonthStatic',
    type: 'post',
    response: config => {
      return {
        code: 20000,
        data: taskMonthStatic.list
      }
    }
  },
  // 全部任务-管理员
  {
    url: '/task/getPageList',
    type: 'get',
    response: config => {
      return {
        code: 20000,
        data: {
          pageSize : 10,
          currentPage : 1,
          totalPages : 3,
          totalCount : 30,
          list : Mock.mock({
            'list|10' : [{
              'id|+100': 10000,
              'taskName|+1': "任务@id",
              'categoryName|1': ["分类2","分类3","分类4","分类5"],
              'taskNo' : "@id",
              'priority|1-3' : 0,
              "chargeName|1": ['张三','李四','王麻子','王五','李狗蛋'],
              'allstate|1' : [0,1],
              "actualBeginTime" : "@date",
              "suoshuxiangmu|1" : ['项目1','项目2','项目3','项目4','项目5'],
              deleteDate : "@datetime",
              'yj|1-24' : 0,
              'isStart|1' : [true,false],
              'yujigongshi' : "@yj 小时",
              'state|0-2' : 0,
              'particUser|3' : [{
                userId : "@id",
                'userName|2-5' : () => {
                  let arr = ['张三','李四','王麻子','王五','李狗蛋'];
                  return arr[Math.floor(Math.random()*5)]
                }
              }]
            }]
          }).list
        }
      }
    }
  },
  // 任务模板
  {
    url: '/task/templet/getPageList',
    type: 'get',
    response: config => {
      return {
        code: 20000,
        data: {
          list : Mock.mock({
            'list|18' : [{
              'id|+100': 10000,
              'name|+1': "@name",
              'sum|0-100' : 0
            }]
          }).list
        }
      }
    }
  },
  //删除任务
  {
    url: '/task/del',
    type: 'get',
    response: _ => {

      return {
        code: 20000,
        data: '',
        msg: "请求成功"
      }
    }
  },
  //审核任务
  {
    url: '/task/operation/examine',
    type: 'get',
    response: _ => {

      return {
        code: 20000,
        data: '',
        msg: "请求成功"
      }
    }
  },
  //关注任务
  {
    url: '/task/follow/execute',
    type: 'get',
    response: _ => {

      return {
        code: 20000,
        data: '',
        msg: "请求成功"
      }
    }
  },
  //完成任务
  {
    url: '/task/operation/handle',
    type: 'get',
    response: _ => {

      return {
        code: 20000,
        data: '',
        msg: "请求成功"
      }
    }
  },
  // 任务详情
  {
    url: '/task/getDetail',
    type: 'get',
    response: config => {
      return {
        code: 20000,
        data: Mock.mock({
          "id": "@id",
          "taskName": "任务一",
          "creatorId": 1,
          "creator|1": ['张三','李四','王麻子','王五','李狗蛋'],
          "chargerId": 1,
          "chargerName|1": ['张三','李四','王麻子','王五','李狗蛋'],
          "categoryName|1": ["分类2","分类3","分类4","分类5"],
          "taskNo": "@id",
          "projectId": 1,
          "projectName": "项目一",
          "markName": "里程碑1",
          "phaseName": "阶段一",
          'priority|1' : ["正常","紧急","非常紧急"],
          "description": "",
          "remark": "这是一个备注信息",
          "operateId": 0,
          "operateStatus|1": [0,1,2,3,4],
          "actualBeginTime": "@date",
          "creatTime": "@date",
          "isFollow|1": [true,false],
          "formIds": [1,2,3],
          'particUser|3' : [{
            userId : "@id",
            'userName|2-5' : () => {
              let arr = ['张三','李四','王麻子','王五','李狗蛋'];
              return arr[Math.floor(Math.random()*5)]
            }
          }],
          "tagList|2-5": [
            {
              "id|+1": 1,
              "taskName": "标签@id"
            }
          ],
          "fileList|2-5": [
            {
              "id|+1": 1,
              "fileName": "文件@id",
              "fileUrl": "http://",
              "extName": "doc"
            }
          ],
          "billList|3": [
            {
              "billId|+1": 1,
              "billName": "重庆化工厂液体套装瓶订购审批单@billId"
            }
          ],
          "progressList": {
            creatDate : "@date",
            endDate : "@date",
            'list|4-8' : [{
              touxiang : "",
              xingming : "@name",
              'caozuo|1' : ["创建了任务",'审批通过','完成任务','未通过'],
              renwuming : '重庆化工厂液体套装瓶任务',
              'renwujieduan|1' : ["第一阶段",'第二阶段','第三阶段']
            }]
          }
        })
      }
    }
  },
  //任务文件
  {
    url: '/task/file/getPageList',
    type: 'get',
    response: config => {
      return {
        code: 20000,
        data: {
          pageSize : 10,
          currentPage : 1,
          totalPages : 3,
          totalCount : 30,
          list : Mock.mock({
            'list|10' : [{
              'id|+100': 10000,
              'taskName|+1': "任务@id",
              'fileNo': "@id",
              'taskId' : "@id",
              "fileName": '订购 @name 文档',
              'fileUrl|1' : ['https://www.6erp.cn/download/%e5%9c%b0%e5%9d%80%e5%bc%95%e7%94%a8%e6%9b%bf%e6%8d%a2?wpdmdl=7812&refresh=5e6985f7cd2dc1583973879'],
              "fileType" : "asd",
              "extName|1" : ['doc','excel','txt','pdf'],
              'uploadDate' : "@date"
            }]
          }).list
        }
      }
    }
  },
]
